#include "StdAfx.h"
#include "BasicShader.h"

VAMPIRE_NAMESPACE_BEGIN

REGISTER_HELPER_IMPLEMENT(BasicShader);

BasicShader::BasicShader(void) : mhModelViewProj(NULL), mModelViewProjMat(Matrix44::IDENTITY), mpTexture(NULL)
{
	setTechniqueName("BasicShader");
}

void BasicShader::bindHandles()
{
	mhModelViewProj = mpData->GetParameterByName(NULL, "modelViewProj");
	mhTexture       = mpData->GetParameterByName(NULL, "meshTexture");
}

void BasicShader::setTransformMatrix( const Matrix44& mat )
{
	mModelViewProjMat = mat;
	mpData->SetMatrix(mhModelViewProj, &(mModelViewProjMat.mData));
}

void BasicShader::setTexture( Texture* tex )
{
	mpTexture = tex;
	mpData->SetTexture(mhTexture, mpTexture->mpData);
}

VAMPIRE_NAMESPACE_END